//提示用户输入三组数据，并且每组数据有5个值，假设用户输入的值正确无需验证。
#include <stdio.h>

void average(int ar[][5]);//计算每一组数据的平均值
void max(int ar[][5]);//比较得出所有数据的最大值,每一组函数都需要有打印功能！！！
void toall_average(int ar[][5]);//计算出所有数据的平均值

int main(void)
{
	int totall[3][5];
	int count = 0;
	int circul;
	int input;
	int circul2;
	while (count <= 2)
	{
		for (circul = 0; circul <= 4; circul++)
		{
			printf("输入第%d组数的第%d个数(只可以输入2位整数):", count, circul);
			scanf_s("%d", &input, 2);
			totall[count][circul] = input;
		}
		count++;
	}
	printf("your charaters are as flows:\n");
	for (circul = 0;circul <= 2; circul++)
	{
		for (circul2 = 0; circul2 <= 4; circul2++)
			printf("%4d", totall[circul][circul2]);
		printf("\n");
	}
	average(totall);              //计算每一组数据的平均值
	max(totall);                  //比较得出所有数据的最大值
	toall_average(totall);        //计算出所有数据的平均值
	return 0;
}
/*进行函数的编写*/
void average(int ar[][5])//计算每一组数据的平均值
{
	int sum=0;
	float aver=0;
	int circul, circul2;
	printf("*****************************\n");
	printf("计算得出每一组的平均值\n");
	for (circul = 0; circul <= 2; circul++)
	{
		for (circul2 = 0; circul2 <= 4; circul2++)
		{
			sum = sum + ar[circul][circul2];
		}
		aver = sum / 5;
		printf("第%d组的平均值是%f\n", circul, aver);
		sum = 0;
	}
	//print this result

}
void max(int ar[][5])//比较得出所有数据的最大值
{
	int circul,circul2;
	int max;
	max = ar[0][0];
	for (circul = 0; circul <= 2; circul++)
	{
		for (circul2 = 0; circul2 <= 4; circul2++)
		{
			if (max < ar[circul][circul2])
				max = ar[circul][circul2];
		}
	}
	printf("所有数据中最大的值是:%d\n", max);
}
void toall_average(int ar[][5])//计算出所有数据的平均值
{
	int sum=0;
	int circul, circul2;
	float ever;
	for (circul = 0;circul <= 2;circul++)
	{
		for (circul2 = 0;circul2 <= 4;circul2++)
		{
			sum = sum + ar[circul][circul2];
		}
	}
	ever = sum / 15;
	printf("所有的数据的平均值是:%f\n", ever);
}